"""
验证章节内容存储情况
"""
import asyncio
from tortoise import Tortoise
from tool.sessing import TORTOISE_ORM
from models.m import Chapter

async def verify():
    await Tortoise.init(config=TORTOISE_ORM)
    
    print("验证章节内容存储：\n")
    
    # 获取一个章节
    chapter = await Chapter.all().limit(1).first()
    
    if chapter:
        print(f"章节: {chapter.title}")
        print(f"字数: {chapter.word_count}")
        print(f"\n内容预览（前200字符）:")
        if chapter.content:
            print(chapter.content[:200] + "...")
            print(f"\n[OK] 内容已存储在 chapters 表的 content 字段中")
            print(f"内容总长度: {len(chapter.content)} 字符")
        else:
            print("[ERROR] 内容为空")
    else:
        print("[ERROR] 未找到章节")
    
    await Tortoise.close_connections()

asyncio.run(verify())

